<template>
	<view @click="toDetail(data)">
		<view class="box">
			<view class="top">
				<view class="course">
					<view class="weight">
						所属课程:
					</view>
					{{data.courseName}}
				</view>
			</view>

			<view class="content">
				<u-parse :html="data.noteContent"></u-parse>
			</view>

			<view class="bottom">
				<view class="time">
					{{data.lastModifiedTime}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				selectFlag: false
			};
		},
		props: {
			data: {
				type: Object,
				default () {
					return {}
				}
			}
		},
		methods: {
			toDetail(data) {
				if (!this.selectFlag) {
					this.$u.route('pages/course/noteDetail/noteDetail', data);
				}
			},
			cardSelected() {
				this.selectFlag = !this.selectFlag
			},
		}
	}
</script>

<style lang="scss">
	.box {
		background-color: white;
		box-sizing: border-box;
		padding: 10rpx 10rpx 10rpx 10rpx;
		box-sizing: border-box;
		margin: 10px;
		box-shadow: 0 0 5px 1px rgba($color: #000000, $alpha: 0.1);
		border-radius: 5px;

		.top {
			box-sizing: border-box;
			padding-bottom: 15rpx;

			.course {
				display: flex;

				.weight {
					font-weight: bold;
				}
			}
		}

		.content {
			text-indent: 2em;
			box-sizing: border-box;
			padding: 10rpx 5rpx 0rpx 5rpx;
			width: 100%;
			display: -webkit-box;
			overflow: hidden;
			text-overflow: ellipsis;
			word-wrap: break-word;
			white-space: normal !important;
			-webkit-line-clamp: 2;
			-webkit-box-orient: vertical;
			margin-bottom: 10rpx;
		}

		.bottom {
			display: flex;
			flex-direction: row-reverse;
			box-sizing: border-box;
			padding-top: 15rpx;

			.time {
				color: #BED3ED;
			}
		}
	}
</style>
